package com.y.ari.controller;

import com.y.ari.common.RestResponse;
import com.y.ari.dto.ContactsDTO;
import com.y.ari.service.ContactsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 常用联系人信息 前端控制器
 * </p>
 *
 * @author itcast
 */
@Slf4j
@RestController
@RequestMapping("contacts")
public class ContactsController {

    @Autowired
    private ContactsService contactsService;

    @PostMapping("/sel")
    public RestResponse sel() {
        return contactsService.selC();
    }

    @PostMapping("/save")
    public RestResponse save(@RequestBody ContactsDTO contactsDTO) {
        return contactsService.saveC(contactsDTO);
    }

    @PostMapping("/udc/{id}")
    public RestResponse setDc(@PathVariable Long id) {
        return contactsService.setDc(id);
    }

    @DeleteMapping("/del")
    public RestResponse delBatch(@RequestBody List<Long> ids) {
        return contactsService.delBath(ids);

    }
}
